package cn.powerone.scm.domain;

import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import cn.powerone.common.annotation.Excel;
import cn.powerone.common.core.domain.BaseEntity;

/**
 * 不良品信息记录对象 scm_defect_info
 * 
 * @author PowerOne
 * @date 2025-08-05
 */
@Setter
@Getter
public class ScmDefectInfo extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** ID */
    private Long id;

    /** 项目id */
    @Excel(name = "项目id")
    private Long projectId;

    /** 产品id */
    @Excel(name = "产品id")
    private Long productId;

    /** 项目产品ID */
    @Excel(name = "项目产品ID")
    private Long projectProductId;

    /** 订单ID */
    @Excel(name = "订单ID")
    private Long customerOrderId;

    /** 订单编号 */
    @Excel(name = "订单编号")
    private String customerOrderCode;

    /** 售后工单ID */
    @Excel(name = "售后工单ID")
    private Long ticketId;

    /** 供应商订单ID */
    @Excel(name = "供应商订单ID")
    private String supplierOrderId;

    /** 供应商订单编号 */
    @Excel(name = "供应商订单编号")
    private String supplierOrderCode;

    /** 不良发生日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "不良发生日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date defectDate;

    /** 状态|0:-,1:待处理,2:处理中,3:处理完成,4:处理失败 */
    @Excel(name = "状态|0:-,1:待处理,2:处理中,3:处理完成,4:处理失败")
    private Long status;

    /** 检查数量 */
    @Excel(name = "检查数量")
    private Long inspectionCount;

    /** 不良数量 */
    @Excel(name = "不良数量")
    private Long defectCount;

    /** 不良率(%) */
    @Excel(name = "不良率(%)")
    private BigDecimal defectRate;

    /** 不良类型 */
    @Excel(name = "不良类型")
    private String defectType;

    /** 不良内容描述 */
    @Excel(name = "不良内容描述")
    private String defectDetails;

    /** RD原因分析 */
    @Excel(name = "RD原因分析")
    private String reasonAnalysis;

    /** RD对策 */
    @Excel(name = "RD对策")
    private String countermeasure;

    /** 客户接收日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "客户接收日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date customerInDate;

    /** 客户接收数量 */
    @Excel(name = "客户接收数量")
    private Long customerInQuantity;

    /** 客户发货日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "客户发货日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date customerOutDate;

    /** 客户发货数量 */
    @Excel(name = "客户发货数量")
    private Long customerOutQuantity;

    /** 客户发货渠道 */
    @Excel(name = "客户发货渠道")
    private Long customerOutChannel;

    /** RD接收日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "RD接收日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date selfInDate;

    /** RD接收数量 */
    @Excel(name = "RD接收数量")
    private Long selfInQuantity;

    /** RD发货日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "RD发货日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date selfOutDate;

    /** RD发货数量 */
    @Excel(name = "RD发货数量")
    private Long selfOutQuantity;

    /** RD发货渠道 */
    @Excel(name = "RD发货渠道")
    private Long selfOutChannel;

    /** RD接收日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "RD接收日期2", width = 30, dateFormat = "yyyy-MM-dd")
    private Date selfInDate2;

    /** RD接收数量 */
    @Excel(name = "RD接收数量2")
    private Long selfInQuantity2;

    /** RD发货日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "RD发货日期2", width = 30, dateFormat = "yyyy-MM-dd")
    private Date selfOutDate2;

    /** RD发货数量2 */
    @Excel(name = "RD发货数量2")
    private Long selfOutQuantity2;

    /** RD发货渠道2 */
    @Excel(name = "RD发货渠道2")
    private Long selfOutChannel2;

    /** 供应商接收日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "供应商接收日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date supplierInDate;

    /** 供应商接收数量 */
    @Excel(name = "供应商接收数量")
    private Long supplierInQuantity;

    /** 供应商发货日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "供应商发货日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date supplierOutDate;

    /** 供应商发货数量 */
    @Excel(name = "供应商发货数量")
    private Long supplierOutQuantity;

    /** 供应商发货渠道 */
    @Excel(name = "供应商发货渠道")
    private Long supplierOutChannel;

    /** RD到HP的返品时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "RD到HP的返品时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date toCustReturnDate;

    /** 返品数量对应的时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "返品数量对应的时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date returnQuantityTime;

    /** 返品数量 */
    @Excel(name = "返品数量")
    private Long returnQuantity;

    /** 出货数量对应的时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "出货数量对应的时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date shipmentQuantityTime;

    /** 出货数量 */
    @Excel(name = "出货数量")
    private Long shipmentQuantity;

    /** 未代品数量 */
    @Excel(name = "未代品数量")
    private Long unsubstitutedQuantity;

    /** 项目产品信息 */
    private ScmProjectProducts projectProduct;


    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("projectId", getProjectId())
            .append("productId", getProductId())
            .append("projectProductId", getProjectProductId())
            .append("customerOrderId", getCustomerOrderId())
            .append("orderCode", getCustomerOrderCode())
            .append("defectDate", getDefectDate())
            .append("status", getStatus())
            .append("inspectionCount", getInspectionCount())
            .append("defectCount", getDefectCount())
            .append("defectRate", getDefectRate())
            .append("defectType", getDefectType())
            .append("defectDetails", getDefectDetails())
            .append("reasonAnalysis", getReasonAnalysis())
            .append("countermeasure", getCountermeasure())
            .append("toCustReturnDate", getToCustReturnDate())
            .append("returnQuantityTime", getReturnQuantityTime())
            .append("returnQuantity", getReturnQuantity())
            .append("shipmentQuantityTime", getShipmentQuantityTime())
            .append("shipmentQuantity", getShipmentQuantity())
            .append("unsubstitutedQuantity", getUnsubstitutedQuantity())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}
